home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Over 1,000 Windows 95 Programs
/
Over 1000 Windows 95 Programs (Microforum) (Disc 1).iso
/
0071
/
_setup.1
/
SAMPLES.TXT
< prev
next >
Wrap
Text File
|
1997-02-11
|
11KB
|
270 lines
++++++++++++++++++++++++++++++++++++++++++++++
+ WINDOWS PLATFORM +
+ +
+ SOURCE CODE EXAMPLES TO CHANGE SOFTWARE +
+ +
++++++++++++++++++++++++++++++++++++++++++++++
+-- DISCLAIMER PLEASE READ: ------------------------------------+
+ +
+ The following source is provided "as is" without warranty +
+ of any kind, either expressed or implied, including but not +
+ limited to the implied warranties or merchantibility and +
+ fitness for a particular purpose. The entire risk as to the +
+ quality and performance of the program is with you. +
+ +
+ You have a royalty-free right to use, modify, and reproduce +
+ the Sample Source Code exmaples in any way you find useful, +
+ provided that you agree that StanBrite Software has no +
+ warranty, obligations or liability for any Sample Source +
+ Code examples. +
+ +
+---------------------------------------------------------------+
1. Change source code of your software (or document/database).
You need to add some lines of code to your program.
See text below of our "DEMO.C".
Please visit our Web Page Site at "http://www.stanbrite.com" and
you will find examples of how to use DLL functions in different
programming languages:
Visial Basic
Visual C++
Borland C
MS ACCESS
MS WORD
DELPHI
etc.
Use the following function to make a registration process :
CodeReturn = ReminderScreen ("DemoUser", "REMINDER.VLD", "")
where:
"DemoUser" - the Keyword that has been inserted in the
REMINDER.VLD file
"REMINDER.VLD" - VLD file name
"" - Product Name in the REMINDER.VLD file
CodeReturn - code return (As Integer)
= 2 Start in Real mode (no restrictions)
= 3 Start in Real Mode (restrictions exist)
= 4 Start in Demo mode
= 6 Quit button has been pushed
2. Use REMINDER.DLL for 16 bit and REMIND32.DLL for 32 bit
applications.
3. Below you will find source code of the DEMO.EXE program in C language.
***********************
***************
*
=== DEMO.DEF ==========================================================
NAME DEMO
DESCRIPTION 'StanBrite SOFTWARE <C> 1994-1996'
EXETYPE WINDOWS
CODE PRELOAD MOVEABLE
DATA PRELOAD MOVEABLE MULTIPLE
SEGMENTS WM_TEXT LOADONCALL
HEAPSIZE 1024
STACKSIZE 5120
IMPORTS REMINDER.REMINDERSCREEN
=== DEMO.H ==========================================================
/*
*********************************************************
* *
* Registration Manager *
* *
* (Description of DLL functions) *
* *
* Copyright StanBrite SOFTWARE. *
* All rights reserved. *
* 1994 - 1997 *
* *
*********************************************************
*/
/*
**********************
* Code return values *
**********************
*/
#define START_OK 2 /* Start in Real mode and
No Reminder screen */
#define REMINDER_START 3 /* Show the Reminder screen and
Start in Real mode
(prevalidation option) */
#define REMINDER_START_DEMO 4 /* Show the Reminder screen and
Start in Demo mode */
#define REMINDER_NO_START 5 /* Show the Reminder screen and
No Start */
#define STOP_OK 6 /* Quit button has been pushed */
/*
**********************************************************
REMINDER SCREEN DLL (Shows all registration process)
Input:
Keyword - Keyword to run the function
Example: "My_Keyword"
VldFile - Path and name of the validation file
Example: "c:\mydir\myfile.vld"
TitleName - Title Name (30 characters)
Example: "My title of my software"
Process:
checks VLD file:
a. If not registered, then provides step by step
whole registration process.
b. if prevalidation restrictions exists, then
shows a notice screen about expiration,
decreases restrictions.
c. if registered with restrictions, then
shows a notice screen about experation,
decreases restrictions.
d. if registered without restrictions, then returns
the code - START_OK
Output:
see values of the code return above.
**********************************************************
*/
int FAR PASCAL _export ReminderScreen (LPSTR Keyword,
LPSTR VldFile,
LPSTR TitleName);
=== DEMO.C ==========================================================
#include <windows.h> /* Window's header file - always included */
#include <stdlib.h>
#include <string.h>
#include <dir.h>
#include "DEMO.H" /* Parameters for REMINDER.DLL-REMIND32.DLL */
long FAR PASCAL _export WndProc (HWND hWndProc, unsigned int wMessage,
unsigned int wParam, LONG lParam);
/*
******************************************************************
This is a demo program which shows all registration process
******************************************************************
*/
int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpszCmdLine,
int nCmdShow)
{
MSG msg;
WNDCLASS wndclass; /* window class structure */
int codeRet;
HWND hWndParent;
char vldname [255];
if (!hPrevInstance)
{
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = NULL;
wndclass.hCursor = LoadCursor (NULL,IDC_ARROW);
wndclass.hbrBackground = GetStockObject (LTGRAY_BRUSH);
wndclass.lpszMenuName = "MyMenu";
wndclass.lpszClassName = "MyClass";
/* register the new window class */
if (!RegisterClass (&wndclass))
return (0); /* quit if can't register class */
}
/* Create main windows */
hWndParent = CreateWindow ("MyClass",
"Demo of Remote Control Validation",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, // Default horizontal pozition.
CW_USEDEFAULT, // Default vertical pozition
CW_USEDEFAULT, // Default wigth.
CW_USEDEFAULT, // Default height.
NULL, // Overlapped windows have no parents.
NULL, // Use the window class menu.
hInstance, // This unstance owns this window.
NULL); // Pointer not needed.
/*
************************************************
Check for the configuration file
(you may use this code in your application)
************************************************
*/
codeRet = ReminderScreen ("DemoUser", "REMINDER.VLD", "");
ShowWindow (hWndParent, nCmdShow); // display the window
if (codeRet == STOP_OK)
/* Quit button has been pushed */
MessageBox (hWndParent,
"QUIT button has been pushed",
"OK",
MB_OK | MB_ICONEXCLAMATION);
else
if (codeRet == REMINDER_START)
/* The app can be started in REAL mode (prevalidation mode) */
MessageBox (hWndParent,
"PREVALIDATION MODE",
"OK",
MB_OK | MB_ICONEXCLAMATION);
else
if (codeRet == REMINDER_START_DEMO)
/* The app can be started in DEMO mode */
MessageBox (hWndParent,
"DEMO MODE",
"OK",
MB_OK | MB_ICONEXCLAMATION);
else
if (codeRet == START_OK)
/* The app can be started in REAL mode */
MessageBox (hWndParent,
"REAL MODE",
"OK",
MB_OK | MB_ICONEXCLAMATION);
else
MessageBox (hWndParent,
"YOU MUST REGISTER THE PROGRAM",
"REGISTRATION REQUIRED",
MB_OK | MB_ICONEXCLAMATION);
while (GetMessage (&msg, NULL, 0, 0)) /* message loop */
{
TranslateMessage (&msg); /* translate keyboard message */
DispatchMessage (&msg); /* send message to WndProc () */
}
return (msg.wParam); /* quit */
}
/* WndProc () is a custom function for processing messages from Windows */
long FAR PASCAL _export WndProc (HWND hWndProc, unsigned int wMessage,
unsigned int wParam, LONG lParam)
{
switch (wMessage) /* process windows messages */
{
case WM_DESTROY: /* stop application */
PostQuitMessage (0); /* this will exit message loop */
break;
default: /* default windows message processing */
return DefWindowProc (hWndProc, wMessage, wParam, lParam);
}
return (0L);
}
-------------------------------------------
End of file.